Skip to content

Conversation

@JooHyukKim
Copy link
Member

No description provided.

@cowtowncoder
Copy link
Member

@JooHyukKim This seems incomplete? Or maybe diff is missing something due to conflict?

@JooHyukKim
Copy link
Member Author

@cowtowncoder Yes, there were some other commits on same file, affecting this PR. THankss

@JooHyukKim
Copy link
Member Author

Ready for review! Just in case I wasn't clear enough


/**
* We may also have integer-type of representation for Enum's, along with `@JsonValue`.
*
Copy link
Member

@cowtowncoder cowtowncoder Oct 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Since 3.1

*/
protected final boolean _isShapeNumberInt;

public EnumDeserializer(EnumResolver byNameResolver, boolean caseInsensitive,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to start deprecating methods, adding overloads (since it's 3.1, not 3.0)

Copy link
Member

@cowtowncoder cowtowncoder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

return null;
}
if (format.getShape() != JsonFormat.Shape.NUMBER_INT) {
throw new IllegalArgumentException("Failed to access @JsonValue of Enum value ");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this return null? Also, could perhaps also allow Shape.NUMBER.

* Method used when ALL of conditions below are met
*<p>
* 1. actual String serialization is indicated using @JsonValue on a method in Enum class AND
* 2. Enum class is annotated with `@JsonFormat`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... with shape = Shape.NUMBER_INT ?

* 2. Enum class is annotated with `@JsonFormat`
*
*/
public static EnumResolver constructUsingNumberShape(DeserializationConfig config, AnnotatedClass annotatedClass, AnnotatedMember accessor)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should add Javadoc to explain what accessor is for... @JsonValue annotated thing?

for (int i = enumConstants.length; --i >= 0; ) { // from last to first, so that in case of duplicate values, first wins
Enum<?> en = enumConstants[i];
try {
Object o = accessor.getValue(en);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is being accessed here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants